<template>
  <div>
<ul>
  <li v-for="(item,index) in arr" :key="item">
    {{item}}====={{index}}
    <button @click="btn1(index)">删除</button>
  </li>
</ul>
<button @click="btn">生成</button>
<!-- var random = Math.floor(Math.random()*n) -->

  </div>
</template>

<script>
export default {
  data() {
    return {
      arr:[1,5,3]
    }
  },
  methods: {
    
    btn(){
      let random = Math.floor(Math.random()*9)
      this.arr.push(random)
    },
    btn1(i){
   this.arr.splice(i,1)
    }
  },
}
</script>

<style></style>
